package com.zc.controller.yyc.service.Impl;

import com.zc.controller.yyc.mapper.StudentMapper;
import com.zc.controller.yyc.po.Student;
import com.zc.controller.yyc.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    StudentMapper studentMapper;

    @Override
    public List<Student> query() {
        return   studentMapper.query();
    }

    @Override
    public void saveOrupdate(Student student) {
        if (student.getId()==null){
            studentMapper.insert(student);
        }else {
            studentMapper.update(student);
        }
    }

    @Override
    public void delete(int id) {
        studentMapper.delete(id);
    }

    @Override
    public Student queryByid(Student student) {
        return studentMapper.queryByid(student.getId());
    }

}
